package com.loong.game2048.dao;

import com.loong.game2048.module.Picture;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface PictureDao {

    @Insert("insert into picture (f_id,p_name) values(#{f_id},#{p_name})")
    public void addPicture(Picture picture);

    @Select("select * from picture where f_id = #{id}")
    List<Picture> findByFid(Integer id);

    @Select("select p_name from picture where f_id = #{id}")
    List<String> findByFidOnlyName(Integer id);

    @Delete("delete from picture where p_name = #{dbPicName} and f_id = #{id}")
    void deleteByNameAndFid(@Param("dbPicName") String dbPicName , Integer id);

    @Update("update  picture set p_name = #{pName} where p_name = #{pName}")
    void updateByName(@Param("pName")String pName);

    @Select("select * from picture where p_name = #{pName}")
    Picture findByName(@Param("pName")String pName);

    @Delete("delete from picture where f_id = #{id}")
    void deleteByFid(Integer id);
}
